<template>
<!--  问题登记-->
  <div class="wtdj">
    <el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="60px">
      <div class="form-small-title" style="margin-top: 25px">
        <el-divider direction="vertical" class="form-divider"></el-divider>
        <span class="form-small-font">基本信息</span>
      </div>
      <el-row style="margin-top: 25px">
        <el-col :span="12">
          <el-form-item label="问题名称：" label-width="90px">
            <el-input v-model="ruleForm.wtmc" placeholder="请输入" :readonly="status==='read'"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="项目名称：" label-width="90px">
            <el-input v-model="ruleForm.xmmc" placeholder="请输入" :readonly="status==='read'"></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="6">
          <el-form-item label="问题类型：" label-width="90px">
            <el-select v-model="ruleForm.wtlx" placeholder="请选择" :disabled="status==='read'">
              <el-option v-for="item in typeOptions" :key="item.value" :label="item.label"
                         :value="item.value"></el-option>
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="负责人：" label-width="90px">
            <el-input v-model="ruleForm.fuzeren" placeholder="请输入" :readonly="status==='read'"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="新增日期：" label-width="90px">
            <el-date-picker
              v-model="ruleForm.xzrq"
              type="date"
              placeholder="选择日期"
              :readonly="status==='read'"
              style="width: 100%">
            </el-date-picker>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="问题状态：" label-width="90px">
            <el-select v-model="ruleForm.wtzt" placeholder="请选择" :disabled="status==='read'">
              <el-option v-for="item in statusOptions" :key="item.value" :label="item.label"
                         :value="item.value"></el-option>
            </el-select>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="24">
          <el-form-item label="支出事由：" label-width="90px">
            <el-input v-model="ruleForm.fujian" placeholder="请输入" :readonly="status==='read'"></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <div class="form-small-title" style="margin-top: 25px" v-if="status=='read' || status=='edit'">
        <el-divider direction="vertical" class="form-divider"></el-divider>
        <span class="form-small-font">处理信息</span>
      </div>
      <el-row style="margin-top: 25px" v-if="status=='read' || status=='edit'">
        <el-col :span="12">
          <el-form-item label="负责人：" label-width="90px">
            <el-input v-model="ruleForm.fuzeren" placeholder="请输入" :readonly="status==='read'"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="处理日期：" label-width="90px">
            <el-input v-model="ruleForm.riqi" placeholder="请输入" :readonly="status==='read'"></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row v-if="status=='read' || status=='edit'">
        <el-col :span="24">
          <el-form-item label="处理说明：" label-width="90px">
            <el-input v-model="ruleForm.shuoming" placeholder="请输入" :readonly="status==='read'"></el-input>
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>
  </div>
</template>

<script>
export default {
  name: "wtdj",
  data(){
    return{
      ruleForm:{},
      rules:{},
      statusOptions:[],
      typeOptions:[]
    }
  },
  props:{
    status:{
      type: String,
      default: ''
    },
    selectRow:{
      type: Object,
      default: ()=>{}
    }
  },
  watch:{
    selectRow:{
      handler(val) {
        if(this.selectRow){
          this.ruleForm.xmmc = this.selectRow.projectName
          this.ruleForm.xzrq = this.selectRow.date
          this.ruleForm.wtmc = this.selectRow.question
          this.ruleForm.wtlx = this.selectRow.type
          this.ruleForm.wtzt = this.selectRow.state
        }
      },
      immediate: true,
    }
  }
}
</script>

<style scoped lang="scss">
.wtdj ::v-deep{
  .el-input__inner {
    border: 0 !important;
    border-bottom: 1px solid #DCDFE6 !important;
    border-radius: 0 !important;
    padding-right: 20px !important;
  }
}
.form-small-title{
  border-bottom: solid 2px #C0C4CC;
  padding-bottom: 10px;
}
.form-divider{
  width: 5px;
  height: 26px;
  background: rgb(66, 185, 131);
}
.form-small-font{
  font-size: 19px;
  font-weight: 600;
  color: #303133;
}
</style>
